home *** CD-ROM | disk | FTP | other *** search
- Path: en.com!usenet
- From: dpsm@en.com (Dale P. Smith)
- Newsgroups: comp.lang.c++
- Subject: stl newbie help
- Date: Thu, 28 Mar 1996 19:34:30 GMT
- Organization: RheoActive
- Message-ID: <315ae9a1.455438@news.en.com>
- NNTP-Posting-Host: p8-ts4.en.net
- X-Newsreader: Forte Agent .99d/16.182
-
- Help!
-
- I am attempting to understand/use the stl, an while I have dabbled
- in C++ since about 1987, I am not experienced in templates and other
- new features.
-
- Ok, say you have a map. the key is an int and the data is a string.
- map<int, String, less<int>> Table;
-
- I can do:
- Table[3] = "foo be doo";
-
- What I want to understand how to do is declare a function class that
- can be used with something like for_each:
- for_each(Table.begin(), Table.end(), FunctionClassForEachThing);
-
- I know that I have to create a class that has operator() in it. What
- should this thing look like? I can't find (or can't see) any examples
- in the stl documentation.
-
- Thanks!
-
- Dale
-
- Dale P. Smith
- dpsm@en.com home
- dpsm@lubrizol.com work
-